package be.donovan.model.persist;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.orm.jpa.JpaCallback;

import be.donovan.model.Catalog;

public interface PersistenceHelper {
	<T> T find(Class<T> persistent, Serializable id);

	<T> List<T> findAll(Class<T> persistent);

	void delete(Object object);

	void save(Object object);

	void update(Object object);
	
	void refresh(Object object);
	
	<T> List<T> find(Class<T> persistent, String property, Object propertyValue);

	<T> List<T> find(Class<T> persistent, Map<String, Object> propertyMap);

	<T> T findUnique(Class<T> persistent, String property, Object propertyValue);

	<T> T findUnique(Class<T> persistent, Map<String, Object> propertyMap);

	<T> List<T> find (JpaCallback findcb);
	
	<T> T findUnique (JpaCallback findcb);
	
	void execute (JpaCallback cb);

	<T> void saveAll(Collection<T> dataVector);

	Collection<Catalog> findCatalogs(Class<Catalog> clazz, String text);

}
